module.exports = function(playerAction){
    var method = ['rock','scissor','cloth'];
    // 电脑随机出拳
    var computerValue = Math.floor(Math.random()*3);
    var random = method[computerValue];
    // 获取玩家出拳的value值
    var playerValue = method.indexOf(playerAction);
    // 打印两者出拳
    console.log('电脑：'+random);
    console.log('玩家：'+playerAction);
    // 比较
    if(playerValue-computerValue===-1||playerValue-computerValue===2){
        console.log('玩家获胜！');
        return 1;
    } else if(playerValue===computerValue){
        console.log('平局！');
        return 0;
    } else{
        console.log('电脑获胜！');
        return -1;
    }
}